﻿using System.ComponentModel.Composition;
using CoProjectModel;
using IdeaBlade.Application.Framework.Core.Persistence;

namespace CoProjectDF
{
    public class EntityManagerProviderFactory
    {
        ///<summary>
        /// Returns a new instance of the correct EntityMangerProvider to the CompositionHost
        // when requested
        ///</summary>
        [Export]
        public static IEntityManagerProvider<CoProjectEntities> EntityManagerProvider
        {
            get
            {
#if DEBUG
                // For the Debug build, use the fake store EntityManagerProvider
                return new DevelopmentEntityManagerProvider(new SampleDataProvider(new SampleDataLoader()));
#else
                // For the Release build, use the production EntityManagerProvider
                return new EntityManagerProvider();
#endif
            }
        }
    }
}
